#!/bin/bash
#pMusic - frontend
#GPL - Copyright Sigmund Berglund

export TEXTDOMAIN=pmusic
export OUTPUT_CHARSET=UTF-8
. $APPDIR/gui_menu
. $APPDIR/gui_misc
. $APPDIR/gui_add
. $APPDIR/gui_playlist
. $APPDIR/gui_navigation
. $APPDIR/gui_mixer

GUI='
 <vbox> 
  '$GUI_MENUS'
  '$GUI_PROGRESS'

  <hbox spacing="0" shadow-type="0" scrollable="true" height="200" width-request="10"> ###width-request to avoid scrollbars
   <vbox '$ST'>
    <vbox '$SF'>
     '$GUI_ADD_SEARCH'
    </vbox>
    <hbox '$ST'>
     '$GUI_ADD_FIELD'
    </hbox>
   </vbox>
   <text width-request="5"><label>""</label></text>
   <vbox width-request="350">
    '$GUI_PLAYLIST_FIELD'
   </vbox>
   '$GUI_PLAYLIST_TABS'
  </hbox>

  ###album-art
  <hbox height-request="90">
    <eventbox tooltip-text="'$(gettext 'Show track-info window')'" above-child="true" visible-window="true" spacing="0" '$SF'>
     <pixmap>
      <variable>ARTWORK</variable>
      <input file>'$WORKDIR'/albumart.jpg</input>
      <height>90</height>
     </pixmap>
     <action signal="enter-notify-event">disable:ARTWORK</action>
     <action signal="leave-notify-event">enable:ARTWORK</action>
     <action signal="button-release-event">'$APPDIR'/func_kill -trackinfo</action>
     <action signal="button-release-event">echo false > '$WORKDIR'/UPDATE_TRACKINFO</action> ###this to reset conditional timer - workaround
     <action signal="button-release-event">'$APPDIR'/func_trackinfo "" -gui &</action>
    </eventbox>

   <vbox '$ST' spacing="2">
    <hbox>

     <notebook show-tabs="false" show-border="false" labels="1|2|3|4|5|6|7|8|9" height-request="90" '$ST'>
      <vbox '$ST' spacing="0">
       ###svg
       <vbox '$SF'>'$GUI_SVG_NOWPLAYING'</vbox>
       <text height-request="5" '$ST'><label>""</label></text>
       <vbox height-request="16" spacing="0" '$SF'>
        <hbox '$ST'>'$GUI_PROGRESSBAR'</hbox>
       </vbox>
      </vbox>
      <vbox>'$GUI_MSG'</vbox>
      <vbox>'$GUI_MSG2'</vbox>
      <vbox>'$GUI_MSG3'</vbox>
      <variable>NOTEBOOK_MAINGUI</variable>
      <input file>'$WORKDIR'/maingui_notebook_page</input>
     </notebook>
  
    <vbox spacing="2">
     <text height-request="5" '$SF'><label>""</label></text>
     <hbox '$SF'>
      <vbox homogeneous="true" '$SF'>
       <hbox spacing="1" '$SF'>
        '$GUI_BUTTON_PLAYLIST_HISTORY_BACK'
        '$GUI_BUTTON_PLAYLIST_HISTORY_FORWARD'
        '$GUI_BUTTON_NEW'
       </hbox>
      </vbox>
      <text '$ST'><label>""</label></text>
      <hbox '$SF'>
       <vbox>
        '$GUI_NAVIGATION'
       </vbox>
      </hbox>
      <text '$ST'><label>""</label></text>
      <vbox homogeneous="true" '$SF'>
       <hbox spacing="1" '$SF'>
        '$GUI_BUTTON_PLAYMODE'
        '$GUI_BUTTON_MIXER'
       </hbox>
      </vbox>
     </hbox>

     ###Volume
     <hbox width-request="350" spacing="0" height-request="12" '$ST'>
      <text width-request="200" '$ST'><label>""</label></text>
      '$GUI_VOLUME'
     </hbox>

    </vbox>
    <text width-request="30" '$SF'>
     <variable>PLAYQUEUE_TABS_2</variable>
     <label>""</label>
    </text>
   </hbox>
   <vbox height-request="18" '$SF'>
    '$GUI_STATUSBAR'
   </vbox>
  </vbox>
 </hbox>

 </vbox>
 <variable>WINDOW_TITLE</variable>
 <input file>'$WORKDIR'/window_title</input>
 <action signal="show">echo > '$WORKDIR'/gui_is_running</action>
 <action signal="show">'$APPDIR'/func_mixer -get_levels</action>
 <action signal="show">refresh:VOLUME</action>
 <action signal="show">echo 100 > '$WORKDIR'/splash</action>
 <action signal="show" condition="command_is_true([[ $SEARCH_ALBUMART = false ]] && echo true)">hide:ALBUMART_SEARCH</action>
 <action signal="show" condition="command_is_true([[ $(grep -F false '$WORKDIR'/PLAYLIST_MULTIPLE) ]] && echo true)">hide:PLAYQUEUE_TABS</action>
 <action signal="show" condition="command_is_true([[ $(grep -F false '$WORKDIR'/PLAYLIST_MULTIPLE) ]] && echo true)">hide:PLAYQUEUE_TABS_2</action>
 <action signal="delete-event">'$APPDIR'/func -quit &</action>
 <action signal="delete-event">exit:Exit</action>
</window>'
